<template>
	<view class="ctmList">
		<view class="item" url="/pages/qa/detail" v-for="dt in lists" :key="dt._id">
			<view class="teacher">
				<view class="avatar">
					<cm-image  v-if="dt.teacherId._id" :src="dt.teacherId.avatar"/>
				</view>
				<view class="name">{{dt.teacherId.name || dt.teacherId.nickname}}</view>
				<!-- <view class="tips">可预约人数：</view> -->
				<view class="status">{{dt.type==2?'线下咨询':'一对一语音'}}</view>
			</view>
			<view class="wtmsbox tmprbox">
				<view class="time"><text class="lb">时间：</text> {{dt.startTime}} ~ {{dt.endTime}}</view>
				<!-- <view class="price">￥<text class="bp">199</text></view> -->
			</view>
			<view class="wtmsbox">
				<text class="lb">标题：</text>{{dt.title}}
			</view>
			<view class="wtmsbox">
				<text class="lb">人数：</text>(0/{{dt.limit}})
			</view>
			<view class="wtmsbox" v-if="dt.type==2">
				<text class="lb">地址：</text>{{dt.address}}
			</view>
			<view class="wtmsbox">
				<text class="lb">话题：</text>{{dt.content}}
			</view>
			<view class="operBox">
				<view class="btnBox">
					<!-- <navigator v-if="type==1" class="buybtn" url="/pages/preBook/add">立即预约</navigator> -->
					<view v-if="type==1" class="buybtn" @click="goOrder(dt)">立即预约</view>
					<template v-else>
						<i class="iconfont icon-bianji"></i>
						<i class="iconfont icon-changyonggoupiaorenshanchu"></i>
					</template>
				</view>
				<view class="price">￥<text class="bp">{{dt.price}}</text></view>
			</view>

		</view>
	</view>
</template>

<script>
	import {defineComponent,reactive,toRefs,onMounted,getCurrentInstance,computed} from 'vue'
	import {onLoad,onShow} from '@dcloudio/uni-app'
	import { useStore } from 'vuex'
	import bodyWrap from "@/components/bodyWrap/index.vue"
	import cmImage from "@/components/cmImage/index.vue"
	export default defineComponent({
		components:{
			bodyWrap,
			cmImage
		},
		props:{
			type:Number, // 1客户预约界面引用，2专家自己的界面引用,
			lists:Array
		},
		setup(props,context) {
			const store = useStore()
			const {proxy} = getCurrentInstance()
			
			const state = reactive({
				userInfo:computed(()=>store.state.base.userInfo),
			})
			
			onMounted(()=>{
				
			})
			
			const goOrder = (item)=>{
				proxy.$emit('preBook',item)
			}
			
			return {
				...toRefs(state),
				goOrder
			}
		}
	})
</script>

<style lang="scss" scoped>
	.ctmList{
		padding: 0 20rpx 20rpx 20rpx;
		.item{
			display: block;
			background: #fff;
			padding: 20rpx;
			margin: 20rpx 0 0 0;
			.teacher{
				display: flex;
				border-bottom:1px solid #eee;
				padding: 0 0 15rpx 0;
				.avatar{
					width: 60rpx;
					height: 60rpx;
					border-radius: 50%;
					overflow: hidden;
					flex-shrink: 0;
				}
				.name{
					display: flex;
					align-items: center;
					font-size: 28rpx;
					font-weight: 700;
					padding: 0 0 0 10rpx;
					flex-shrink: 0;
					flex: 1;
				}
				.tips{
					display: flex;
					align-items: center;
					font-size: 26rpx;
					color: #999;
					padding: 0 0 0 10rpx;
					flex-shrink: 0;
				}
				.status{
					display: flex;
					align-items: center;
					color: #008800;
					font-weight: bold;
				}
			}
			.wtmsbox{
				padding: 10rpx 0 0 0;
				font-size: 28rpx;
				line-height: 50rpx;
				color: #999;
				.lb{
					font-weight: bold;
					color: #333;
				}
			}
			.tmprbox{
				display: flex;
				align-items: center;
				padding: 10rpx 0 0 0;
				.time{
					flex: 1;
				}
				.price{
					color: #e3af2f;
					font-size: 24rpx;
					.bp{
						font-size: 34rpx;
					}
				}
			}
			.operBox{
				display: flex;
				align-items: center;
				padding: 15rpx 0 0 0;
				.btnBox{
					display: flex;
					align-items: center;
					flex: 1;
					flex-shrink: 0;
					.buybtn{
						width: 180rpx;
						height: 60rpx;
						line-height: 60rpx;
						font-size: 26rpx;
						border-radius: 30rpx;
						text-align: center;
						background: #e3af2f;
						color: #fff;
					}
					.iconfont{
						font-size: 42rpx!important;
						&+.iconfont{
							margin-left: 40rpx;
						}
					}
				}
				.price{
					color: #e3af2f;
					font-size: 24rpx;
					flex-shrink: 0;
					.bp{
						font-size: 34rpx;
					}
				}
			}
		
		}
	}
</style>
